package com.kbckbc.emailmemo;

public class Query {
	static String dbFileName = "emailmemo.db";
	static String createMemoDB = "CREATE TABLE emailmemo(_id INTEGER PRIMARY KEY AUTOINCREMENT, content TEXT, create_dttm TEXT, modf_dttm TEXT, tag TEXT, image_path TEXT, sync TEXT)";

	static String addTagColumn = "ALTER TABLE emailmemo ADD COLUMN tag TEXT DEFAULT VALUE ''";
	static String addImageColumn = "ALTER TABLE emailmemo ADD COLUMN image_path TEXT DEFAULT VALUE ''";
	static String addSyncColumn = "ALTER TABLE emailmemo ADD COLUMN sync TEXT DEFAULT VALUE ''";

	static String selectMemoOrderByCreation = "select _id, content, create_dttm, modf_dttm, tag, image_path, sync from emailmemo where content like '%%%s%%' and tag like '%%%s%%' order by create_dttm desc";
	static String selectMemoOrderByModification = "select _id, content, create_dttm, modf_dttm, tag, image_path, sync from emailmemo where content like '%%%s%%' and tag like '%%%s%%' order by modf_dttm desc";
	static String selectUnsyncMemoOrderByCreation = "select _id, content, create_dttm, modf_dttm, tag, image_path, sync from emailmemo where sync = '' order by create_dttm desc";
	static String selectTagOrderByCharacter = "select distinct tag from emailmemo order by tag";

	
	static String updateMemo = "UPDATE emailmemo SET content = '%s', tag = '%s', image_path = '%s', modf_dttm = '%s', sync = '%s' where _id = %d";
	static String updateMemoSyncComplete = "UPDATE emailmemo SET sync = '%s' where _id in (%s)";
	static String updateAllMemoUnSync = "UPDATE emailmemo SET sync = ''";
	
	static String insertMemo = "INSERT INTO emailmemo VALUES (null,'%s','%s','%s','%s','%s','%s')";
	static String deleteMemo = "DELETE FROM emailmemo WHERE _id in (%s)";
}
